home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / tde31.zip / CFGMACRO.C < prev    next >
C/C++ Source or Header  |  1993-08-29  |  2KB  |  85 lines

  1. /*
  2.  * This module contains all the routines needed to save an existing macro
  3.  * definition file in tde.exe
  4.  *
  5.  * Program Name:  tdecfg
  6.  * Author:        Frank Davis
  7.  * Date:          October 5, 1991
  8.  */
  9.  
  10. #include <io.h>
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <string.h>
  14.  
  15. #include "tdecfg.h"
  16. #include "cfgmacro.h"
  17.  
  18. extern struct vcfg cfg;
  19. extern FILE *tde_exe;                  /* FILE pointer to tde.exe */
  20. extern long macro_offset;
  21.  
  22. static WINDOW *w_ptr;
  23.  
  24. MACRO macros;
  25.  
  26. /********    EXTREMELY IMPORTANT   ************/
  27. /*
  28.  * If you modify tde, it is your responsibility to find the offset of
  29.  * the macro buffer in your new executable, tde.exe.
  30.  *
  31.  */
  32.  
  33.  
  34.  
  35. /*
  36.  * Name:    tdehelp
  37.  * Date:    October 1, 1991
  38.  * Notes:   Set up most of the window global variables.
  39.  */
  40. void tdemacro( void )
  41. {
  42. int c;
  43. char fname[82];
  44. FILE *macro_file;                  /* FILE pointer to macro */
  45.  
  46.  
  47.    cls( );
  48.    show_box( 0, 0, macro_screen, NORMAL );
  49.    xygoto( 42, 14 );
  50.    c = getkey( );
  51.    while (c != '1' && c != '2')
  52.       c = getkey( );
  53.    if (c == '1') {
  54.       puts( "" );
  55.       puts( "" );
  56.       puts( "" );
  57.       puts( "Enter file name that contains the macro definitions :" );
  58.       gets( fname );
  59.       if ((c = access( fname, EXIST )) != 0) {
  60.          puts( "\nFile not found.  Press any key to continue." );
  61.          c = getkey( );
  62.          cls( );
  63.          return;
  64.       } else if ((macro_file = fopen( fname, "rb" )) == NULL ) {
  65.          puts( "\nCannot open macro file.  Press any key to contine." );
  66.          c = getkey( );
  67.          cls( );
  68.          return;
  69.       }
  70.  
  71.       fread( (void *)¯os.first_stroke[0], sizeof(int), MAX_KEYS, macro_file );
  72.       fread( (void *)¯os.strokes[0], sizeof(STROKES), STROKE_LIMIT, macro_file );
  73.       fseek( tde_exe, macro_offset + 8, SEEK_SET );
  74.       fwrite( (void *)¯os.first_stroke[0], sizeof(int), MAX_KEYS, tde_exe );
  75.       fwrite( (void *)¯os.strokes[0], sizeof(STROKES), STROKE_LIMIT, tde_exe );
  76.       fclose( macro_file );
  77.       puts( "" );
  78.       puts( "" );
  79.       puts( "" );
  80.       puts( "New macros successfully installed.  Press any key to continue." );
  81.       c = getkey( );
  82.    }
  83.    cls( );
  84. }
  85.